package cn.theten52.demo.patterns.design.behavior.memento.update1;

/**
 * 状态实现类
 *
 * @author wangjin
 * @date 2021/4/4
 */
public class StateImpl implements State {
    private int val;

    private StateImpl(int val) {
        this.val = val;
    }

    public StateImpl() {
    }

    @Override

    public int value() {
        return val;
    }

    @Override

    public State increase() {
        val++;
        return this;
    }

    @Override

    public State decrease() {
        val--;
        return this;
    }

    @Override

    public Object clone() {
        return new StateImpl(val);
    }
}
